package hu.mapro.flang.gwt.client.ui;

import hu.mapro.flang.gwt.domain.client.AutoBeans;
import hu.mapro.flang.gwt.domain.client.AutoBeans.Book;
import hu.mapro.flang.gwt.domain.client.AutoBeans.BookFields;
import hu.mapro.flang.gwt.domain.client.AutoBeans.UserPrivilege;
import hu.mapro.gwtui.gxt.client.data.GxtDataUtils;
import hu.mapro.gwtui.gxt.client.fieldseditor.field.Util;
import hu.mapro.gwtui.gxt.client.modelkeyprovider.entity.LongIdModelKeyAdapter;

import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.widget.core.client.form.ComboBox;




public class CreateFieldVisitor extends AutoBeans.CreateFieldVisitor {

	@Override
	public <O, I extends hu.mapro.model.meta.SingularField<UserPrivilege,O> & hu.mapro.model.Setter<UserPrivilege,O>> hu.mapro.gwtui.gxt.client.fieldseditor.field.EditorFieldInterface<?> setUserPrivilege(I inverseField) {
		return new UserPrivilegesEditor(inverseField);
	}
	
	@Override
	public hu.mapro.gwtui.gxt.client.fieldseditor.field.EditorFieldInterface<?> scalarBook() {
		ComboBox<Book> field = new ComboBox<Book>(new ListStore<Book>(new LongIdModelKeyAdapter()), GxtDataUtils.labelProvider(BookFields.title));
		return Util.createValueEditorField(field);
	}
	
}
